-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
annotate dispatch method entry point with @Generated #3080
Conversation
I don't really like the generic name |
OK, but in that case the annotation should be in
Do you mean JaCoCo or Sonar? |
If we agree on such a specific annotation, I'd put it next to StringConcatenationClient with class retention.
Here is a very concise description of meta-annotations: https://docs.spring.io/spring-framework/reference/core/beans/classpath-scanning.html#beans-meta-annotations In a nutshell: Rather than putting the But @cdietrich raises a fair question: Would we always emit |
yes. am not sure if we still have the old javax.annotation.Generated present. |
@szarnekow so a meta-annotation is just an annotation put on another annotation; if I understand correctly what you suggest, I manually tried and it didn't work: @Retention(RetentionPolicy.CLASS)
@Target({TYPE, METHOD, CONSTRUCTOR})
public @interface Generated {
} and @Retention(RetentionPolicy.CLASS)
@Target({TYPE, METHOD, CONSTRUCTOR})
@Generated
public @interface Dispatcher {
String dispatchCase();
int arity();
} but JaCoCo does NOT ignore the annotated method: @Dispatcher(dispatchCase = "_m", arity = 1)
public String m(final Object i) {
if (i instanceof Integer) {
return _m((Integer)i);
} else if (i instanceof String) {
return _m((String)i);
} else {
throw new IllegalArgumentException("Unhandled parameter types: " +
Arrays.<Object>asList(i).toString());
}
} As I said in #3077 JaCoCo expects that "The name of the annotation includes Generated." Concerning @Retention(SOURCE)
@Target({PACKAGE, TYPE, ANNOTATION_TYPE, METHOD, CONSTRUCTOR, FIELD,
LOCAL_VARIABLE, PARAMETER})
public @interface Generated { That is a source annotation so it cannot be used to this aim. Concerning always generating the new annotation, I'd go with always generating that. And it's unrelated to the other existing one. The current |
In the meantime, I rebased on |
So: we'll use |
Can we check the annotation removal in lsp4j |
(Lsp4j uses xtend/xbase lib as compile time only dependencies |
Could you please elaborate? I don't understand what you mean |
in lsp4j the java classes generated from xtend classes we have some code in annotation processing that takes care. |
Could you please point me to where we take care of this (annotation processing)? |
just check the lsp4j repo and https://github.com/eclipse-lsp4j/lsp4j/blob/f235e91fbe2e45f62e185bbb9f6d21bed48eb2b9/org.eclipse.lsp4j.generator/src/main/java/org/eclipse/lsp4j/generator/JsonRpcDataProcessor.xtend#L27 unfortunately your branch does not build. |
maybe we are safe if they dont use dispatch |
We should also make this optional (enabled by default) and expose a generator config that allows to opt-out from that |
Sorry I didn't have time yet to fix the failing tests. |
Label in UI could be |
@szarnekow So |
Freudian slip. XbaseGenerated |
5bcc229
to
ba07d30
Compare
lsp4j does not seem to use dispatches. java.lang.AssertionError: Architecture Violation [Priority: MEDIUM] - Rule 'no classes that reside in a package 'org.eclipse.lsp4j..' and not reside in a package 'org.eclipse.lsp4j.generator..' and not reside in a package 'org.eclipse.lsp4j.test..' should depend on classes that reside in a package 'org.eclipse.xtext..'' was violated (1 times): |
@cdietrich Thanks for testing it! I'll add the compiler option soon anyway. |
@szarnekow I've implemented the new option, the involved commit is a33af2e Here's how the properties dialog looks like By enabling project specific settings, and disabling the option: By enabling the option again: |
ping... |
@cdietrich @szarnekow could we take a decision on this please? |
sry i have zero cappa for looking at anything atm. |
Closes #3077
I put the new
Generated
annotation in xbase.lib instead of xtend.lib because it could be useful in general for Xbase languages